<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <div id="div">
        <button type="button" onclick="DDsaoMa()">扫码</button>

    </div>
<!--    <script src="//g.alicdn.com/dingding/open-develop/1.6.9/dingtalk.js"></script>-->
    <script src="https://g.alicdn.com/dingding/dingtalk-jsapi/2.10.3/dingtalk.open.js"></script>
    <script>
        //扫码 可以用
        function DDsaoMa() {
            dd.ready(function () {
                dd.biz.util.scan({
                    type: 'all', // type 为 all、qrCode、barCode，默认是all。
                    onSuccess: function (data) {
                        //onSuccess将在扫码成功之后回调
                        /* data结构
                         { 'text': String}
                         */
                        alert(JSON.stringify(data));
                    },
                    onFail: function (err) {}
                })
            });
        }

    </script>
</body>

</html>